package com.thread.exem;

/**
 * @author げっしょく
 * @date 2021/8/7
 */
public class Test66 {
    public static void main(String[] args) {
        Object o = new Object();
        Object o1 = new Object();
        new Thread(() -> {
            synchronized (o){
                try {
                    Thread.sleep(1);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                synchronized (o1){
                    System.out.println("aaa");
                }
            }
        }).start();
        new Thread(() -> {
            synchronized (o1){
                try {
                    Thread.sleep(1);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                synchronized (o){
                    System.out.println("bbb");
                }
            }
        }).start();
    }
}
